package com.example.industry;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.sql.Connection;

@SpringBootApplication
public class IndustryApplication {

    public static void main(String[] args) {
        SqlFileExecutor sqlFileExecutor = new SqlFileExecutor();
        MySqlConnector connector = new MySqlConnector();
        try {
            connector.connectDatabase();
            Connection conn = connector.getConnection();
            sqlFileExecutor.executeSql(conn,"sql/createProjectTable.sql");
            sqlFileExecutor.executeSql(conn, "sql/createTaskTable.sql");
            sqlFileExecutor.executeSql(conn, "sql/createUserTable.sql");
            conn.close();
        }catch (Exception e){
            e.printStackTrace();
            return;
        }
        SpringApplication.run(IndustryApplication.class, args);
    }

}
